package org.koyad.portal.tags;

import javax.el.ExpressionFactory;
import javax.el.ValueExpression;

import org.koyad.piston.el.PistonELContext;
import org.koyad.piston.el.PistonELResolver;


public class TagUtils {
	public static Object getValue(String expression) {
		
		PistonELContext simpleCtx = new PistonELContext(PistonELResolver.DEFAULT_RESOLVER_READ_ONLY);
		
		ExpressionFactory expressionFactory = ExpressionFactory.newInstance();
		ValueExpression valueExp = expressionFactory.createValueExpression(simpleCtx, expression, Object.class);
		
		return valueExp.getValue(simpleCtx);
	}
}
